package org.baicaixiaozhan.springbootwebdemo2.config;

import io.jsonwebtoken.security.Keys;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.crypto.SecretKey;

/**
 * DESC:
 *
 * @author : baicaixiaozhan
 * @since : 2021-01-30
 */
@Configuration
@AllArgsConstructor
public class SecureKeyConfig {

    private final JwtConfig jwtConfig;

    @Bean
    public SecretKey secretKey() {
        return Keys.hmacShaKeyFor(jwtConfig.getSecureKey().getBytes());
    }
}
